package com.rd.student.jiaji.class1.wangyufang.day0731;

import java.util.ArrayList;

public class TestRandom3 {
    public static void main(String[] args) {
        ArrayList<Integer> list = new ArrayList<>(20);
        for (int i = 0; i < 20; i++) {
            int n = (int) (Math.random() * 50);
            if (list.contains(n)) {
                i--;
                continue;
            }
            list.add(n);
        }
        System.out.println(list);
    }
}
